/*
 *  dna_platform.h -- provide Hardware platform adapter interface.
 *
 *  ORIGINAL AUTHOR: Xu Chun (chun.xu@broadlink.com.cn)
 */

#ifndef __DNA_PLATFORM_H
#define __DNA_PLATFORM_H

/*
*  Timertask flash area (or file) read interface.
*  Return actual read number.
*/
int dna_timertask_read(unsigned int addr, unsigned char * buffer, unsigned int len);

/*
*  Timertask flash area (or file) write interface.
*  Return actual written number.
*/
int dna_timertask_write(unsigned int addr, const unsigned char * buffer, unsigned int len);

/*
*  Timertask flash area (or file) erase [set 0xFF...0xFF] interface.
*  Return 0 means erase success.
*/
int dna_timertask_erase(unsigned int addr, unsigned int len);

/*
*  License read interface.
*  Return actual read number.
*/
int dna_license_read(unsigned int addr, unsigned char * buffer, unsigned int len);

/*
*  Get PSM area space size interface (file or flash).
*  Return actual space size (bytes).
*/
int dna_psm_size(unsigned int psm_type);

/*
*  PSM area raw write interface (file or flash).
*  Return actual written number.
*/
int dna_psm_write(unsigned int psm_type, unsigned int addr,
        const unsigned char * buffer, unsigned int len);

/*
*  PSM area raw erase interface (file or flash, set 0xFF...0xFF).
*  Return actual erase number.
*/
int dna_psm_erase(unsigned int psm_type, unsigned int addr, unsigned int len);

/*
*  PSM area raw read interface (file or flash).
*  Return actual read number.
*/
int dna_psm_read(unsigned int psm_type, unsigned int addr,
        unsigned char * buffer, unsigned int len);

/*
*  Profile entry get interface.
*  Return physical address.
*/
unsigned long dna_profile_entry(void);

/*
*  Profile read interface.
*  Return actual read number.
*/
int dna_profile_read(
#ifdef CONFIG_SUPPORT_DNA_GATEWAY
        unsigned char pid[16],
#endif
        unsigned int addr, unsigned char * buffer, unsigned int len);

/*
*  Profile write interface (used for airconfig).
*  Return actual written number.
*/
int dna_profile_write(
#ifdef CONFIG_SUPPORT_DNA_GATEWAY
        unsigned char pid[16],
#endif
        unsigned int addr, const unsigned char * buffer, unsigned int len);

/*
*  Profile cleanup interface (used for airconfig).
*
*  Return 0 means cleanup success.
*/
int dna_profile_cleanup(
#ifdef CONFIG_SUPPORT_DNA_GATEWAY
        unsigned char pid[16]
#endif
        );

/*
*  Hardware platform get product test flag interface.
*  Return TRUE means product no test.
*/
int dna_platform_get_protest_flag(void);

/*
*  Hardware platform set product test flag interface.
*/
int dna_platform_set_protest_flag(void);

/*
*  Hardware platform clear product test flag interface.
*/
int dna_platform_clr_protest_flag(void);

/*
*  Hardware platform reset interface.
*  (erase nvram data, such as PSM and timertask, but needn't reboot)
*/
int dna_platform_reset(void);

unsigned long dna_platform_syscall_vector_addr(void);
unsigned long dna_platform_user_entry_addr(void);

#endif

